<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <%@include file="common/head.jspf" %>
    </head>

    <body class="messages-page sb-l-o sb-r-c sb-l-o" data-menu="#menu_contract" data-list="#li_contract">

        <!-- 主体内容开始 -->
        <div id="main">

            <!--侧边导航栏-->
            <%@include file="common/sidebar.jspf" %>

            <!-- Start: Content-Wrapper -->
            <section id="content_wrapper">

                <!-- 顶部导航 -->
                <header id="topbar">
                    <div class="topbar-left">
                        <ol class="breadcrumb">
                            <li class="crumb-active">
                                <span>软擎科技</span>
                            </li>
                            <li class="crumb-icon">
                                <a href="dashboard"><span class="glyphicon glyphicon-home"></span></a>
                            </li>
                            <!-- 当前页 -->
                            <li class="crumb-trail">合同模板管理</li>
                        </ol>
                    </div>
                    <div class="topbar-right">
                        <!-- 登录信息 -->
                        <%@include file="common/session.jspf" %>
                    </div>
                </header>
                <!-- 顶部导航结束 -->

                <!-- 页面内容开始 -->
                <section id="content" class="pn">
                    <!--标的认证模板-->
                    <div class="table-layout">
                        <aside class="tray tray-left w320 va-t" data-tray-height="match">
                            <div id="templateList">
                                <!-- menu links -->
                                <h4 class="mb15">合同模板列表</h4>
                                <hr class="mn br-light">
                                <div class="fs16 text-muted mt25 text-center loading-info"><i class="mr10 fa fa-spin fa-spinner"></i>加载中 ...</div>
                                <ul class="nav nav-messages p5 fs14 mt10" role="menu" id="templateUl"></ul>
                                <hr class="br-light mt10 mb15">
                                <button id="add_template" type="button" class="btn btn-system btn-block fw600"><i class="fa fa-plus mr5"></i>添加模板</button>
                            </div>

                            <div id="addTemplateBox" class="shide">
                                <h4 class="mb15"> 上传合同模板 </h4>
                                <hr class="mn br-light">
                                <div class="fileupload fileupload-new admin-form mt20" data-provides="fileupload">
                                    <div class="tray-bin mb10 cursor-pointer text-center pt20 text-muted-lighter" id="upZone">
                                        <i class="fa fa-folder-open-o mr10 fs20"></i>点击选择文件
                                    </div>
                                    <div class="section br-b pv10 shide text-center" id="imagePreview">
                                        <img src="${rootPath}/img/doc/pdf_file.png" alt="" />
                                    </div>
                                    <div class="section mb10">
                                        <label for="fileName" class="field">
                                            <input type="text" name="fileName" id="fileName" class="event-name gui-input br-light light" placeholder="模板名称">
                                        </label>
                                    </div>
                                    <div class="section mb10">
                                        <label class="field select">
                                            <select id="category" name="category">
                                                <option value="LOAN">借款合同</option>                                                
                                            </select>
                                            <i class="arrow"></i>
                                        </label>
                                    </div>
                                    <div class="section mt15 mb20 hidden">
                                        <div class="option-group field text-right">
                                            <label class="option option-primary mrn pr5">
                                                <input type="checkbox" name="isDefault" id="isDefault">
                                                <span class="checkbox"></span>设为默认模板</label>
                                        </div>
                                    </div>

                                    <button class="btn btn-primary btn-block" id="doUploadBtn">保存模板</button>
                                    <button class="btn bg-light darker btn-block" id="cancelAdd">取消</button>

                                    <form action="" name="uploadForm" class="hidden" >
                                        <input type="file" id="fileInput"/> 
                                        <button class="btn btn-danger hidden" id="uploadBtn"><i class="icon-ok"></i> 上传</button>
                                    </form>
                                </div>
                            </div>
                        </aside>

                        <div class="tray tray-center p10 va-t">
                            <!--<div class="fs16 text-muted mt25 text-center" id="loading"><span class="fa fa-spin fa-spinner mr10"></span>加载中 ..</div>-->
                            <div id="pdfContainer" class="media">
                                <iframe width="100%" height="100%" style="border: 1px solid #ddd;"
                                        src="" 
                                        id="pdfReader"></iframe>
                            </div>
                        </div>
                    </div>
                </section>
                <!-- 页面内容结束 -->

            </section>
        </div>
        <!-- 主体内容结束 -->

        <script type="text/x-tmpl-mustache" id="templateTemplate">
            {{#result}}
            <li class="contractTemplate" id="{{id}}" data-url="contract/template/{{id}}">
                <a href="javascript:;" class="fw600 p10">
                    <span class="fa fa-dot-circle-o mr5"></span> {{name}} <code class="fw400 shide">默认</code>
                    <div class="btn-group pull-right">
                        <button data-url="contract/setDefault/{{id}}" class="btn btn-default light btn-xs set-default-link" role="button" title="设为默认模板"><i class="fa fa-check-square-o text-muted"></i></button>
                        <button data-url="contract/deleteTemplate/{{id}}" class="btn btn-default light btn-xs delete-template-link" role="button" title="删除"><i class="fa fa-trash text-muted"></i></button>
                    </div>
                </a>
            </li>
            {{/result}}
        </script>

        <!-- 公共函数 -->
        <%@include file="common/scripts.jspf" %>
        <script src="${rootPath}/js/pages/contract.js" type="text/javascript"></script>
    </body>
</html>
